Truncate and Fix are equivalent functions. However, Truncate is preferred in Crystal syntax whereas Fix is preferred in Basic syntax.
Truncate(x) returns a whole number by truncating the number at the decimal point. If the #places argument is specified, the number is truncated to the decimal place indicated and the function returns a fractional Number. If #places is negative, the number is rounded to the first ten, hundred, and so on.
Use this function whenever the characters to the right of the decimal are not needed for a report or calculation.
The following examples are applicable to both Basic and Crystal syntax, although Fix is preferred in the latter:
If you have 147 golf balls in stock and want to know how many dozen are available for sale, your calculation is 147/12=12.25 12.25 (truncated) = 12 dozen available for sale. If you sell balls only by the dozen, the .25 dozen you truncated is unimportant.
Truncate({file.BALL INVENTORY} / 12)
Returns 12 where Ball inventory = 147 (147 / 12 = 12.25, 12.25 truncated = 12).
Truncate({file.BALL INVENTORY} / 12)
Returns 12 where Ball inventory = 155 (155/12 = 12.92, 12.92 truncated = 12).
Truncate({file.BALL INVENTORY} / 12)
Returns 13 where Ball inventory = 157 (157/12 = 13.08, 13.08 truncated = 13).
See the Round (x), Round (x, #places) for an explanation on rounding.
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |